package com.lcsuo.credit.dao;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.lcsuo.credit.entity.CompanySummary;

/**
 * 公司定价dao
 * @author penghaozhong
 *
 */
@Mapper
public interface CompanysummaryMapper {


	@Update("update companysummary set balance = balance-#{balance},totaltransactioncount = totaltransactioncount+1,"
			+ "totalexpensecount = totalexpensecount+1,updatetime =#{updatetime}  where companycode = #{companycode} and balance >0 ")
	int update(@Param("companycode") String companycode,@Param("balance") BigDecimal balance,@Param("updatetime") String updatetime);

	@Select("select * from companysummary")
	List<CompanySummary> findAll();
	
	@Select("select * from companysummary where companycode = #{companycode}")
	CompanySummary findByCompanyCode(@Param("companycode") String companycode);


}
